type key = K : forall b. (b * (b -> int)) -> key

let as_int x = 
  match x with 
  | K a (y, f) -> f (y)
  end
